package com.xyazm.order.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 订单取消类型枚举
 * @author xuyou
 * 2022/5/15 0015 18:16
*/
@Getter
public enum OrderCancelTypeEnum {

    USER_CANCELED(0, "用户手动取消"),
    TIMEOUT_CANCELED(1, "超时未支付自动取消");

    private Integer code;

    private String msg;

    OrderCancelTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static OrderCancelTypeEnum getByCode(Integer code) {
        for (OrderCancelTypeEnum element : OrderCancelTypeEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }


}
